package com.shop2cn.iapi.livebuyer.service;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*查询商品列表Call
*FreeMaker Template自动生成代码
*/
public class QueryProductListCall extends YmatouBaseCall{
	private static String opurl ="api/QueryProductList";
	
	public QueryProductListCall() {
		super(EnvSetup.getSystemUrl("livebuyer_iapi_shop2cn"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	public Integer getPageCount()
    {
		return getJsonObject().get("data").getAsJsonObject().get("pageCount").getAsInt();
    }
	public Integer getTotalCount()
    {
		return getJsonObject().get("data").getAsJsonObject().get("totalCount").getAsInt();
    }
	public JsonArray getProductList()
    {
		JsonElement plist = getJsonObject().get("data").getAsJsonObject().get("productList");
		if(plist.isJsonNull()){
			return null;
		}
		return plist.getAsJsonArray();
    }
}